/*  1:   */ package org.intellij.plugins.relaxNG.compact.parser;
/*  2:   */ 
/*  3:   */

import com.intellij.lang.PsiBuilder;
import com.intellij.lang.PsiBuilder.Marker;
import com.intellij.psi.tree.IElementType;
import org.intellij.plugins.relaxNG.compact.RncElementTypes;
import org.intellij.plugins.relaxNG.compact.RncTokenTypes;

/*  4:   */
/*  5:   */
/*  6:   */
/*  7:   */
/*  8:   */
/*  9:   */ 
/* 10:   */ public class NameClassParsing
/* 11:   */   extends AbstractParsing
/* 12:   */ {
/* 13:   */   public NameClassParsing(PsiBuilder paramPsiBuilder)
/* 14:   */   {
/* 15:28 */     super(paramPsiBuilder);
/* 16:   */   }
/* 17:   */   
/* 18:   */   public boolean parseNameClass()
/* 19:   */   {
/* 20:32 */     PsiBuilder.Marker localMarker = this.myBuilder.mark();
/* 21:34 */     if (!a())
/* 22:   */     {
/* 23:35 */       localMarker.drop();
/* 24:36 */       return false;
/* 25:   */     }
/* 26:39 */     if (currentToken() == RncTokenTypes.PIPE)
/* 27:   */     {
/* 28:   */       do
/* 29:   */       {
/* 30:41 */         advance();
/* 31:42 */         if (!a()) {
/* 32:43 */           error("NameClass expected");
/* 33:   */         }
/* 34:45 */       } while (currentToken() == RncTokenTypes.PIPE);
/* 35:46 */       localMarker.done(RncElementTypes.NAME_CLASS_CHOICE);
/* 36:   */     }
/* 37:   */     else
/* 38:   */     {
/* 39:48 */       localMarker.drop();
/* 40:   */     }
/* 41:50 */     return true;
/* 42:   */   }
/* 43:   */   
/* 44:   */   private boolean a()
/* 45:   */   {
/* 46:54 */     IElementType localIElementType = currentToken();
/* 47:55 */     PsiBuilder.Marker localMarker = this.myBuilder.mark();
/* 48:56 */     if (RncTokenTypes.IDENTIFIER_OR_KEYWORD.contains(localIElementType))
/* 49:   */     {
/* 50:57 */       advance();
/* 51:   */     }
/* 52:58 */     else if (RncTokenTypes.PREFIXED_NAME == localIElementType)
/* 53:   */     {
/* 54:59 */       makeName();
/* 55:   */     }
/* 56:60 */     else if (RncTokenTypes.STAR == localIElementType)
/* 57:   */     {
/* 58:61 */       advance();
/* 59:62 */       b();
/* 60:   */     }
/* 61:63 */     else if (RncTokenTypes.PREFIXED_STAR == localIElementType)
/* 62:   */     {
/* 63:64 */       makeName();
/* 64:65 */       b();
/* 65:   */     }
/* 66:66 */     else if (RncTokenTypes.LPAREN == localIElementType)
/* 67:   */     {
/* 68:67 */       advance();
/* 69:68 */       if (parseNameClass()) {
/* 70:69 */         match(RncTokenTypes.RPAREN, "')' expected");
/* 71:   */       }
/* 72:   */     }
/* 73:   */     else
/* 74:   */     {
/* 75:72 */       localMarker.drop();
/* 76:73 */       return false;
/* 77:   */     }
/* 78:75 */     localMarker.done(RncElementTypes.NAME_CLASS);
/* 79:76 */     return true;
/* 80:   */   }
/* 81:   */   
/* 82:   */   private void b()
/* 83:   */   {
/* 84:80 */     if (RncTokenTypes.MINUS == currentToken())
/* 85:   */     {
/* 86:81 */       PsiBuilder.Marker localMarker = begin();
/* 87:82 */       if (!parseNameClass()) {
/* 88:83 */         error("NameClass expected");
/* 89:   */       }
/* 90:85 */       localMarker.done(RncElementTypes.EXCEPT_NAME_CLASS);
/* 91:   */     }
/* 92:   */   }
/* 93:   */ }



/* Location:           E:\idea\

 * Qualified Name:     org.intellij.plugins.relaxNG.compact.parser.NameClassParsing

 * JD-Core Version:    0.7.0.1

 */